package util

import "encoding/json"

//常量都定义在这里

const (
	TOPIC_REPORT_ACK          = "usr.report_ack"
	TOPIC_D2T_ACK             = "usr.d2t_ack"
	TOPIC_ADD_DEVICE          = "/subdevice/add"
	TOPIC_ADD_DEVICE_ACK      = "/subdevice/add/ack"
	TOPIC_DEL_DEVICE          = "/subdevice/del"
	TOPIC_DEL_DEVICE_ACK      = "/subdevice/del/ack"
	TOPIC_GET_DEVICE_LIST_ACK = "/subdevice/list/ack"
	TOPIC_CLEAN_DEVICE_ACK    = "/gateway/clean/ack"
	TOPIC_SET_ALARM_DEVICE    = "/subdevice/set_alarm_device"

	TOPIC_CLEAN_ALL_INFRARED_ORDER_LIST = "/subdevice/infrared/order/clean"
	TOPIC_DEL_INFRARED_ORDER            = "/subdevice/infrared/order/del"

	TOPIC_UNLOCK_GENERATE = "/subdevice/unlock/generate"

	TOPIC_TRANSPORT     = "usr.ctl"
	TOPIC_TRANSPORT_ACK = "usr.ctl_ack"
)

const (
	TOPIC_OTA_UPDATE       = "/ota/update/check"
	TOPIC_OTA_GET_PRECENT  = "/ota_get_progress/"
	TOPIC_OTA_START_UPDATE = "/ota_start_update/"
)

const (
	TOPIC_ADD_SCENE      = "/scene/add"
	TOPIC_DEL_SCENE      = "/scene/del"
	TOPIC_UPDATE_SCENE   = "/scene/update"
	TOPIC_LIST_SCENE_ACK = "/scene/list/ack"
	TOPIC_EXE_SCENE      = "/scene/exe"
	TOPIC_ENABLE_SCENE   = "/scene/enable"
)

const (
	TOPIC_ADD_DEFENCE    = "/defence/add"
	TOPIC_DELETE_DEFENCE = "/defence/delete"
	TOPIC_UPDATE_DEFENCE = "/defence/update"
	TOPIC_SWITCH_DEFENCE = "/defence/switch"
)

const (
	TOPIC_MSMART20_TRANSPORT_ACK = "/msmart20/transport/ack"
)

const (
	MSMART_USER_IS_MASTER       = 110
	MSMART_USER_IS_SHARED_USER  = 109
	MSMART_USER_NOT_OWN_GATEWAY = 108
	MSMART_USER_ROLE_IS_ILLEGAL = 107

	MSMART_GATEWAY_IS_BOUND_BY_USER     = 301
	MSMART_GATEWAY_IS_NOT_BOUND_BY_USER = 302

	MSMART_DB_ERROR = -100
)

//设置报警子备
type Subdeviceinfo struct {
	Nodeid          string `json:"nodeid",omitempty`
	Is_alarm_device string `json:"is_alarm_device,omitempty"`
}

type PayloadInfo struct {
	Msgid       string          `json:"msgid",omitempty`
	Applianceid string          `json:"applianceid,omitempty"`
	Username    string          `json:"username,omitempty"`
	Passcode    string          `json:"passcode,omitempty"`
	Expire      int             `json:"expire,omitempty"`
	Nodelist    []Subdeviceinfo `json:"nodelist,omitempty"`
	//Is_alarm_device string `json:"is_alarm_device,omitempty"`
	Topic    string `json:"topic,omitempty"`
	SceneID  int32  `json:"sceneID,omitempty"`
	NodeID   string `json:"nodeid,omitempty"`
	OrderID  string `json:"order_id,omitempty"`
	Name     string `json:"name,omitempty"`
	Code     int    `json:"code,omitempty"`
	Msg      string `json:"msg,omitempty"`
	Deviceid string `json:"deviceid,omitempty"` //貌似极光推送才用到
	Userid   string `json:"userid,omitempty"`
	//Data     interface{} `json:"data,omitempty"`
	Status    string          `json:"status,omitempty"` // only used for get_gateway_device_status
	DefenceID string          `json:"defenceid,omitempty"`
	Switch    string          `json:"switch,omitempty"`
	Data      json.RawMessage `json:"data,omitempty"`
}
